]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
search: Ensure that the default result is visible in the scroll view
authorRui Matos <tiagomatos@gmail.com>
Thu, 20 Mar 2014 10:27:05 +0000 (11:27 +0100)
committerRui Matos <tiagomatos@gmail.com>
Wed, 26 Mar 2014 10:42:32 +0000 (11:42 +0100)
The default result is set to selected when key focus enters the search
entry. We must also scroll the view if needed.

https://bugzilla.gnome.org/show_bug.cgi?id=726759

js/ui/search.js

index e544497cf39547bd85c56d3ba8f6215735582f9c..919642a9a192ca5f7cab19adf7fbd2365e430c22 100644 (file)
@@ -629,8 +629,11 @@ const SearchResults = new Lang.Class({
         if (newDefaultResult != this._defaultResult) {
             if (this._defaultResult)
                 this._defaultResult.setSelected(false);
-            if (newDefaultResult)
+            if (newDefaultResult) {
                 newDefaultResult.setSelected(this._highlightDefault);
+                if (this._highlightDefault)
+                    Util.ensureActorVisibleInScrollView(this._scrollView, newDefaultResult.actor);
+            }
 
             this._defaultResult = newDefaultResult;
         }
@@ -667,8 +670,11 @@ const SearchResults = new Lang.Class({
 
     highlightDefault: function(highlight) {
         this._highlightDefault = highlight;
-        if (this._defaultResult)
+        if (this._defaultResult) {
             this._defaultResult.setSelected(highlight);
+            if (highlight)
+                Util.ensureActorVisibleInScrollView(this._scrollView, this._defaultResult.actor);
+        }
     },
 
     navigateFocus: function(direction) {